<?php

namespace App\Listeners;

use App\Events\UserRegistered;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use App\Models\Wallet;
use App\Models\PowerLog;


class AddToWallet
{
    /**
     * Create the event listener.
     *
     * @return void
     */
    public function __construct()
    {
        //
    }

    /**
     * Handle the event.
     *
     * @param  AddToWallet  $event
     * @return void
     */
    public function handle(UserRegistered $event)
    {

        $wallet = new Wallet();
        $wallet->user_id = $event->user_id;
        $wallet->computing_power = 100;
        $wallet->save();
        PowerLog::add_log($event->user_id,1,100,1);
    }
}
